<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			function changeH1(){
				var d=document.getElementById("t");
				var s=d.innerHTML;//获得
				alert(s);
				//d.innerHTML="现象级畅销书";//赋值
				d.innerText="<h1>现象级畅销书</h1>";
				//d.innerHTML="<h1>现象级畅销书</h1>";
				d.align="center";
			}
			function likeAll(){
				var ar=document.getElementsByName("like");
				for(var i in ar){
					ar[i].checked=true;
				}
			}
			function clearDiv(){
				var d=document.getElementsByTagName("div");
				for(var i=0;i<d.length;i++){
					d[i].innerHTML="";
				}
			}
		</script>
	</head>
	<body>
		<form>
			<div id="t">岛上书店</div>
			<input type="button" value="改变标题" onclick="changeH1()" />
			<div>
				最喜欢的书:
				<input type="checkbox" name="like" value="monkeyking"/>西游记
				<input type="checkbox" name="like" value="三国"/>三国演义
				<input type="checkbox" name="like" value="红楼梦"/>红楼梦
				<input type="checkbox" name="like" value="史记"/>史记
			</div>
			<input type="button" value="都喜欢" onclick="likeAll()" />
			<input type="button" value="clear div"  onclick="clearDiv()"/>
		</form>
	</body>
</html>
